<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>

        function checkName(){

            var pd=/^[a-zA-Z\u4e00-\u9fa5]{2,}$/
            if (pd.test($("textInput").value)){
                if ($("textInput").value==="贺玺"){
                    $("iSpan").innerHTML = "验证失败它不是人";
                    $("iSpan").style.color = "red";
                }else {
                    $("iSpan").innerHTML = "验证通过";
                    $("iSpan").style.color = "green";
                }

            }else {
                $("iSpan").innerHTML = "姓名必须为两位以上的字母或汉字";
                $("iSpan").style.color = "red";
            }

        }
        function $(ID){
            return document.getElementById(ID);
        }
    </script>
</head>
<body>
请输入姓名<input type="text" id="textInput" onblur="checkName();">
<span id="iSpan"></span>

</body>
</html>